package com.example.dllo.my36kr.ui.fragment;

import android.os.Bundle;
import android.widget.ListView;
import com.example.dllo.my36kr.R;
import com.example.dllo.my36kr.model.NewsDatasBean;
import com.example.dllo.my36kr.net.SingleVolley;
import com.example.dllo.my36kr.net.VolleyResult;
import com.example.dllo.my36kr.tools.NewsUrls;
import com.example.dllo.my36kr.ui.adapter.NewsAdapter;
import com.google.gson.Gson;
import com.youth.banner.Banner;

import java.util.ArrayList;
import java.util.List;

/**
 *  弃用了
 * 抽屉点击进来的页面
 * 目的是为了不让新闻界面的头视图显示 这样就没有轮播图了
 * Created by CPC_272 on 16/8/20.
 */
public class NewsDrawerFragment extends AbsBaseFragment implements VolleyResult {
    private ListView ls_News;
    private String url = NewsUrls.ALL_URL;
    private int type=1;
    @Override
    protected int setLayout() {
        return R.layout.fragment_news;
    }

    @Override
    protected void initView() {
        ls_News = byView(R.id.news_ls);
    }

    @Override
    protected void initData() {

//        SingleVolley.getInstence(context).startRequest(url,this );
//        Bundle bundle = getArguments();
//        type = bundle.getInt("type");

    }

    @Override
    public void success(String str, int type) {

    }

    @Override
    public void success(String str) {
        Gson gson=new Gson();
        NewsDatasBean newsDatasBean = gson.fromJson(str, NewsDatasBean.class);
        NewsAdapter newsAdapter = new NewsAdapter(getContext());
        newsAdapter.setData(newsDatasBean);
        ls_News.setAdapter(newsAdapter);
    }

    @Override
    public void failure() {

    }
}
